package main

import (
	"net"
	"sync/atomic"
)

var globalSessionId uint64

func NewSession(conn net.Conn) (*Session, error) {
	id := atomic.AddUint64(&globalSessionId, 1)
	db, err := net.Dial("tcp", config.Backend)
	if err != nil {
		return nil, err
	}
	return &Session{id: id, client: conn, db: db}, nil
}
